package abc.secgroup.music_backend.entity;

import javax.persistence.*;
import java.util.List;
import java.util.Set;

@Entity
@Table(name = "t_repository")
public class RepositoryDO extends ResourceDO{

    //全局唯一ID
    @Column(name="guid")
    private String guid;

    //歌曲名称
    @Column(name = "repo_name")
    private String name;

    //演唱者
    @ManyToMany(targetEntity = SingerDO.class,cascade = CascadeType.ALL)
    @JoinTable(name="t_repo_singer",
            joinColumns = {@JoinColumn(name="singer_id",referencedColumnName = "guid")},
            inverseJoinColumns = {@JoinColumn(name="repo_id",referencedColumnName = "guid")})
    private Set<SingerDO> singerSet;

    //所属专辑
    @ManyToOne(targetEntity = AlbumDO.class,cascade = CascadeType.ALL)
    @JoinColumn(name="repo_album")
    private AlbumDO album;

    //对应歌词
    @OneToOne(mappedBy = "repo")
    private LyricDO lyric;

    @OneToMany(mappedBy = "musicComment")
    private List<CommentDO> commentList;

    public String getGuid() {
        return guid;
    }

    public void setGuid(String guid) {
        this.guid = guid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Set<SingerDO> getSingerSet() {
        return singerSet;
    }

    public void setSingerSet(Set<SingerDO> singerSet) {
        this.singerSet = singerSet;
    }

    public AlbumDO getAlbum() {
        return album;
    }

    public void setAlbum(AlbumDO album) {
        this.album = album;
    }

    public LyricDO getLyric() {
        return lyric;
    }

    public void setLyric(LyricDO lyric) {
        this.lyric = lyric;
    }
}
